﻿/// <reference path="../jquery/jquery-1.3.2-vsdoc.js" />


//浏览
function view_node(id, type) {
	switch (type) { 
		case "drive":
		case "folder":
		default:
			break;
		case "default":
			window.open('/Post/Details/' + id);
			break;
	}
}

//编辑
function edit_node(id, type) {
	switch (type) { 
		case "drive":
		case "folder":
		default:
			break;
		case "default":
			window.open('/Post/Edit/' + id);
			break;
	}
}

//选择
function select_node(id, type, param) {
	switch (type) {
		case "drive":
		case "folder":
			//$("#post_grid").reload({ id: id });
			var url = "/Post/PostPanel/"+id  ; // $("#post_grid").attr("url")+ "/" + id;
			$.post(url, param, function(data) {
				$("#post_panel").html(data);
			});
			break;
		case "default":
		default:
			break;
	}
}

//删除
function delete_node(id, type, name) {
	switch (type) {
		case "drive":
		case "folder":
			if (!confirm("是否删除文件夹：" + name + "?")) {
				return false;
			}
			break;
		case "default":
		default:
			if (!confirm("是否删除文件：" + name + "?")) {
				return false;
			}
			break;
	}
	$.ajax({
		type: 'GET',
		url: '/Post/Delete/'+id ,
		//data: { id: id },
		dataType: 'json',
		success: function(data) {
			if (data.success) {
				alert("删除成功！");
				$('#post_grid').refresh();
			} else {
				alert("删除失败:" + data.message);
			}
		},
		error: function(data) {
			alert(data);
		}
	});
}

//搜索
function search_post() {
	$("#post_grid").reload($("form").serialize());
	
}